//index.js
//获取应用实例
const app = getApp()
const http = require('../../utils/http');
Page({
    data: {
        baseUrl: http.baseUrl,
        page:0,
        moreList:[],
        currentIndex: 0,
        "firstList": ["LXT", "LXT", "LXT", "LXT", "LXT", "LXT"],
        "secondList": ["GFF", "GFF", "GFF", "GFF", "GFF", "GFF", "GFF", "GFF"]
    },
    onLoad: function (options) {
        //进入页面获取type

        // this.onReachBottom();
    },
    //swiper切换时会调用
    pagechange: function (e) {
        if ("touch" === e.detail.source) {
            let currentPageIndex = this.data.currentIndex
            currentPageIndex = (currentPageIndex + 1) % 2
            this.setData({
                currentIndex: currentPageIndex
            })
        }
    },
    //用户点击tab时调用
    titleClick: function (e) {
        let currentPageIndex =
            this.setData({
                //拿到当前索引并动态改变
                currentIndex: e.currentTarget.dataset.idx
            })
    },
    // 下拉刷新
    // onReachBottom: function () {
    //
    //
    //     var that = this;
    //     // 显示加载图标
    //     wx.showLoading({
    //         title: '玩命加载中',
    //     })
    //     // 页数+1
    //     that.data.page = that.data.page + 1;
    //     http._get('/api/show/page/' + that.data.page + '/20').then(res => {
    //       console.log(res);
    //       var moment_list = that.data.moreList;
    //       const oldData = that.data.moreList;
    //       if (res.records.length == 0 || res.current > res.pages){
    //         wx.showLoading({
    //           title: '暂无更多数据',
    //         })
    //       }else{
    //         that.setData({
    //           moreList: oldData.concat(res.records)
    //         })
    //       }
    //       wx.hideLoading();
    //     })
    // },
    //跳转到详情
    goDetails: function (e) {
        const id = e.currentTarget.dataset.id;
        wx.navigateTo({
            url: '../../jchd/details/details?id=' + id
        })
    },

})
